package com.ascainiao3d.display
{
	
	import flash.display.Graphics;
	/**
	 * 3D显示对象的基类
	 * @author XJY
	 * 
	 */	
	public class Object3D
	{
		protected var _x:Number=0;
		protected var _y:Number=0;
		protected var _z:Number=0;
		
		protected var tempx:Number = 0;
		protected var tempy:Number = 0;
		protected var tempz:Number = 0;
		
		/*protected var _vpx:Number;
		protected var _vpy:Number;*/
		protected var _parent:Object3D;
		
		public function Object3D()
		{
			
		}

		public function get x():Number
		{
			return _x;
		}

		public function set x(value:Number):void
		{
			_x = value;
		}

		public function get y():Number
		{
			return _y;
		}

		public function set y(value:Number):void
		{
			_y = value;
		}

		public function get z():Number
		{
			return _z;
		}

		public function set z(value:Number):void
		{
			_z = value;
		}
		
		public function draw(graphics:Graphics):void{
			
		}
		
		
		public function setPosition(x:Number,y:Number,z:Number):void{
			_x=x;
			_y=y;
			_z=z;
		}

		public function get parent():Object3D
		{
			return _parent;
		}

		public function set parent(value:Object3D):void
		{
			_parent = value;
		}
		public function setVariable(light:Light,vpX:Number, vpY:Number,cX:Number,cY:Number,cZ:Number):void{
			/*this._vpx = vpX;
			this._vpy = vpY;
			this.cX = cX;
			this.cY = cY;
			this.cZ = cZ;*/
		}
		public function rotateX(angleX:Number):void
		{
			/*var cosX:Number = Math.cos(angleX);
			var sinX:Number = Math.sin(angleX);
			var y1:Number = y * cosX - z * sinX;
			var z1:Number = z * cosX + y * sinX;
			y = y1;
			z = z1;*/
		}
		public function rotateY(angleY:Number):void
		{
			/*var cosY:Number = Math.cos(angleY);
			var sinY:Number = Math.sin(angleY);
			var x1:Number = x * cosY - z * sinY;
			var z1:Number = z * cosY + x * sinY;
			x = x1;
			z = z1;*/
		}
		public function rotationXY(angleX:Number,angleY:Number):void{
			var cosX:Number = Math.cos(angleX);
			var sinX:Number = Math.sin(angleX);
			var y1:Number = tempy * cosX - tempz * sinX;
			var z1:Number = tempz * cosX + tempy * sinX;
			y = y1;
			z = z1;
			var cosY:Number = Math.cos(angleY);
			var sinY:Number = Math.sin(angleY);
			var x1:Number = tempx * cosY - z * sinY;
			z1 = z * cosY + tempx * sinY;
			x = x1;
			z = z1;
		}
		public function snapshot():void{
			tempx=x;
			tempy=y;
			tempz=z;
		}
	}
}